Crate ipipe[−][src]
Expand description
Cross-platform named-pipe API.
Quick Start
To get started quickly, try using Pipe::with_name to create a pipe with a given name.
use ipipe::Pipe;
use std::io::BufRead;
fn reader()
{
let mut pipe = Pipe::with_name("test_pipe").unwrap();
println!("Pipe path: {}", pipe.path().display());
// Read lines
for line in std::io::BufReader::new(pipe).lines()
{
println!("{}", line.unwrap());
}
}
Then in another program or thread:
use ipipe::Pipe;
use std::io::Write;
fn writer()
{
let mut pipe = Pipe::with_name("test_pipe").unwrap();
writeln!(&mut pipe, "This is only a test.").unwrap();
}
You can also use Pipe::create
to open a pipe with a randomly-generated
name, which can then be accessed by calling Pipe::path.
Lastly, Pipe::open can be used to specify an exact path. This is not platform agnostic, however, as Windows pipe paths require a special format.
Calling clone()
on a pipe will create a slave instance. Slave instances
will not delete or close the pipe when they go out of scope. This allows
readers and writers to the same pipe to be passed to different threads and
contexts.
Macros
Print a string to a static pipe
Print a string and a trailing newline to a static pipe
Structs
Abstraction over a named pipe
Enums
Functions
Closes a static pipe
Closes all static pipes
Get a handle to an existing static pipe
Initialize a static pipe and return a handle to it.
The lowest-level static-pipe print function. Panics if pipe is not initialized.